防止matplotlib.pyplot中的科学记数法 |
您所在的位置:网站首页 › matplotlib 关闭绘图 › 防止matplotlib.pyplot中的科学记数法 |
防止matplotlib.pyplot中的科学记数法
我们在使用matplotlib.pyplot绘制图像时,如果统计的数据过大图标上就会出现用科学计数法的方式显示,例如 import matplotlib.pyplot as plt import numpy as py # 求平方数 x_values = py.linspace(0, 100000000) y_value = [x**2 for x in x_values] plt.style.use('seaborn') fig, ax = plt.subplots() ax.scatter(x_values, y_value, c=y_value, cmap=plt.cm.Reds, s=20) plt.show()
输入以下这行代码 ax.ticklabel_format(style='plain')即 import matplotlib.pyplot as plt import numpy as py # 求平方数 x_values = py.linspace(0, 100000000) y_value = [x**2 for x in x_values] plt.style.use('seaborn') fig, ax = plt.subplots() ax.scatter(x_values, y_value, c=y_value, cmap=plt.cm.Reds, s=20) ax.ticklabel_format(style='plain') plt.show()可得 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |